package com.suixuan.support.util;

import org.springframework.util.StringUtils;

/**
 * 
 * @Title: ArrayUtils.java
 * @Package com.suixuan.support.util
 * @Description: 数组值互相转换
 * @author suixuan
 * @date 2010-11-12 下午01:49:24
 * @version V1.0
 */
public final class ArrayUtils {

	private ArrayUtils() {
		super();
	}

	public static Long[] parseLong(String[] s) {
		Long[] l = new Long[s.length];
		for (int i = 0; i < l.length; i++) {
			if (StringUtils.hasText(s[i])) {
				l[i] = Long.parseLong(s[i]);
			}
		}

		return l;
	}

	public static Integer[] parseInteger(String[] s) {
		Integer[] l = new Integer[s.length];
		for (int i = 0; i < l.length; i++) {
			if (StringUtils.hasText(s[i])) {
				l[i] = Integer.parseInt(s[i]);
			}
		}

		return l;
	}

	public static Float[] parseFloat(String[] s) {
		Float[] l = new Float[s.length];
		for (int i = 0; i < l.length; i++) {
			if (StringUtils.hasText(s[i])) {
				l[i] = Float.parseFloat(s[i]);
			}
		}

		return l;
	}

	public static Double[] parseDouble(String[] s) {
		Double[] l = new Double[s.length];
		for (int i = 0; i < l.length; i++) {
			if (StringUtils.hasText(s[i])) {
				l[i] = Double.parseDouble(s[i]);
			}
		}

		return l;
	}

	public static String[] parseString(Number[] n) {
		String[] l = new String[n.length];
		for (int i = 0; i < l.length; i++) {
			if (StringUtils.hasText(l[i])) {
				l[i] = String.valueOf(n[i]);
			}
		}

		return l;
	}

	public static boolean isEmpty(long[] array) {
		return org.apache.commons.lang.ArrayUtils.isEmpty(array);
	}

	public static boolean isEmpty(int[] array) {
		return org.apache.commons.lang.ArrayUtils.isEmpty(array);
	}

	public static boolean isEmpty(float[] array) {
		return org.apache.commons.lang.ArrayUtils.isEmpty(array);
	}

	public static boolean isEmpty(double[] array) {
		return org.apache.commons.lang.ArrayUtils.isEmpty(array);
	}

}
